<script setup lang="ts">
import { ref } from "vue";
import { reqScoringData } from "@/api/credit/peasants/score";
import DictTag from "@/components/DictTags/index.vue";

const title = ref("查看评分情况");
const dialogVisible = ref(false);

const tableData = ref([]);
const loading = ref(false);

// 默认倒开对话框
const show = async (item: any = {}) => {
  // 根据户主ID获取户主的评分情况
  await reqScoringData(item.hzId).then((req: any) => {
    tableData.value = req.rows;
  }).catch((e) => {});
  // 打开对话框
  setTimeout(() => {
    dialogVisible.value = true;
  }, 500);
};

const close = () => {
  tableData.value = [];
}


defineExpose({
  show
});
</script>

<template>
  <el-dialog width="50%" v-model="dialogVisible" @close="close">
    <template #title>
      <span class="el-dialog__title">{{ title }}</span>
    </template>
    <el-table v-loading="loading" :data="tableData" style="width: 100%" border>
      <el-table-column label="ID" prop="scoreId" width="100" align="center"></el-table-column>
      <el-table-column label="评议员姓名" prop="nickName" width="100" align="center"></el-table-column>
      <el-table-column label="评议员电话号码" prop="userPhonenumber" width="150" align="center"></el-table-column>
      <el-table-column label="评议状态" prop="finishStatus" width="100" align="center">
        <template #default="scope">
          <DictTag :value="scope.row.finishStatus" :options="dict.type.cre_score_status"></DictTag>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" prop="createTime"  align="center"></el-table-column>
      <el-table-column label="修改时间" prop="updateTime"  align="center"></el-table-column>
    </el-table>
    <template #footer>
      <el-button type="danger" @click="dialogVisible = false">关闭</el-button>
    </template>
  </el-dialog>
</template>

<script lang="ts">
export default {
  dicts: ["cre_score_status"]
};
</script>

<style scoped lang="scss">
@import "../index";
</style>
